home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
BMUG PD-ROM BV3
/
BMUG PD-ROM Version BV3 (CDRM1097900).iso
/
QuickTime
/
QuickTime Utilities
/
E D T V
/
menu.c
< prev
next >
Wrap
Text File
|
1991-12-05
|
3KB
|
120 lines
/****************************************************************************/
/* */
/* Application: E D T V */
/* */
/* Description: This file contains all the routines for handling */
/* menu events. */
/* */
/* File: menu.c */
/* */
/* Files: about.c - routines for the about box */
/* EDTV.c - routines for displaying movies */
/* menu.c - routines for handling the menu */
/* remote.c - routines for controlling the movie */
/* EDTV.h - header file information */
/* */
/* Programmer: Edgar Lee */
/* Organization: Apple Computer, Inc. */
/* Department: Developer Technical Support, DTS */
/* Language: C (Think C version 5.0) */
/* Date Created: 10-26-91 */
/* */
/****************************************************************************/
#include "EDTV.h"
MenuHandle appleMenu, fileMenu;
enum {
appleID = 1,
fileID
};
enum {
openItem = 1,
closeItem,
quitItem = 4
};
/*-------------------------------------------------------------------------------------*/
void setUpMenus()
{
InsertMenu( appleMenu = NewMenu( appleID, "\p\024" ), 0 );
InsertMenu( fileMenu = NewMenu( fileID, "\pFile" ), 0 );
DrawMenuBar();
AppendMenu( appleMenu, "\pAbout E D T V...;(-" );
AddResMenu( appleMenu, 'DRVR' );
AppendMenu( fileMenu, "\pLoad Movie.../O;Eject/W;(-;Power Off/Q" );
}
/*-------------------------------------------------------------------------------------*/
void adjustMenus()
{
register WindowPeek wp = (WindowPeek)FrontWindow();
short kind = wp ? wp->windowKind : 0;
Boolean DA = kind < 0;
enable( fileMenu, quitItem, true );
enable( fileMenu, openItem, gMoviesStatus == NO_MOVIE );
enable( fileMenu, closeItem, gMoviesStatus == MOVIE_LOADED );
enable( fileMenu, quitItem, true );
}
/*-------------------------------------------------------------------------------------*/
void enable( menu, item, ok )
MenuHandle menu;
{
if (ok)
EnableItem( menu, item );
else
DisableItem( menu, item );
}
/*-------------------------------------------------------------------------------------*/
void handleMenu( mSelect )
long mSelect;
{
int menuID = HiWord( mSelect );
int menuItem = LoWord( mSelect );
GrafPtr savePort;
Str255 name;
switch (menuID)
{
case appleID:
if (menuItem == 1)
doAboutBox();
else
{
GetPort( &savePort );
GetItem( appleMenu, menuItem, name );
OpenDeskAcc( name );
SetPort( savePort );
}
break;
case fileID:
switch (menuItem)
{
case openItem:
selectMovie();
break;
case closeItem:
closeMovie();
break;
case quitItem:
quit();
break;
}
break;
}
HiliteMenu( 0 );
}